package com.budwk.app.sms.controller;

import com.budwk.app.sms.dto.SmsMsgDTO;
import com.budwk.app.sms.service.OpaSmsService;
import com.budwk.app.sms.service.TencentSmsService;
import com.budwk.starter.common.openapi.annotation.ApiDefinition;
import com.budwk.starter.common.openapi.annotation.ApiImplicitParams;
import com.budwk.starter.common.openapi.annotation.ApiOperation;
import com.budwk.starter.common.openapi.annotation.ApiResponses;
import com.budwk.starter.common.result.Result;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.GET;
import org.nutz.mvc.annotation.Ok;

/**
 * @author ZY.Wang
 * @since 2023/5/29
 */
@IocBean
@At("/sms/tencent")
@ApiDefinition(tag = "腾讯短信发送")
@Slf4j
public class TencentSmsController {

    @Inject
    private TencentSmsService tencentSmsService;

    @Inject
    OpaSmsService opaSmsService;

    @At
    @Ok("json")
    @GET
    @ApiOperation(name = "获取RSA密钥", description = "获取RSA密钥")
    @ApiImplicitParams
    @ApiResponses
    public Result<?> send() {
        SmsMsgDTO msgDTO = new SmsMsgDTO();
        msgDTO.setPhoneNumberSet(Sets.newHashSet("15140272785"));
        msgDTO.setTemplateParamList(Lists.newArrayList("黄国利", "金元"));
        //Integer sendCount = tencentSmsService.txSmsSendOneMessage(msgDTO);
        opaSmsService.opaSmsSendOneMessage(msgDTO);
        return Result.success();
    }
}
